import { InputSource, InputSourceConfig } from '@/types';
import { request } from 'umi';

/**
 * 获取所有输入源
 */
export const getInputSources = (server: string) => {
  return request<InputSource[]>(`${server}/input/source`);
};

/**
 * 获取所有输入源配置
 */
export const getInputSourceConfigs = (server: string) => {
    return request<InputSourceConfig[]>(`${server}/input/getInputSourceConfigs`);
};

/**
 * 更新输入源配置
 * @param data
 */
export const updateInputSourceConfig = (
  server: string,
  data: InputSourceConfig[],
) => {
  return request(`${server}/input/updateInputSourceConfigs`, {
    method: 'post',
    data,
  });
};
